/**
         * @description: 1、router实现hash模式
         * @param {*}
         * @return {*}
         */
const app = document.getElementById("app");
window.addEventListener('load', () => {
    console.log(location)
    console.log(location.hash)
    console.log(location.hash.slice(1))
    app.innerText = location.hash.slice(1)
})
window.addEventListener('hashchange', () => {
    console.log("监听hash值改变！")
    console.log(location)
    console.log(location.hash)
    app.innerText = location.hash.slice(1)
})
/**
 * @description: 2、router实现history
 * @param {*}
 * @return {*}
 */
var html = document.getElementById("root");
function go(pathname) {
    html.innerText = pathname;
    history.pushState({}, null, pathname)
}
window.addEventListener('popstate', () => {
    console.log("监听history改变！")
    go(location.pathname);
})